/**********************
 ***	CstXml.c   ***
 **********************/
#include	<stdio.h>
#include	"Uigp/igp.h"


#include "XmlPut.h"



void	
xmlPut_tag_string( FILE *fp, int align, char *name, char *value )
{
	int	i;

	for(  i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	fprintf( fp, "<%s>%s</%s>\n", name, value, name );
}


void	
xmlPut_tag_int( FILE *fp, int align, char *name, int value )
{
	int	i;

	for(  i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	fprintf( fp, "<%s>%d</%s>\n", name, value, name );
}




void	
xmlPut_tag_float( FILE *fp, int align, char *name, float value )
{
	int	i;

	for(  i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	fprintf( fp, "<%s>%f</%s>\n", name, value, name );
}




void	
xmlPut_tag_open( FILE *fp, int align, char *name )
{
int	i;

	for( i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	fprintf( fp, "<%s>\n", name );
}

void	
xmlPut_tag_close( FILE *fp, int align, char *name )
{
	int	i;

	for( i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	fprintf( fp, "</%s>\n", name );
}







void	
xmlPut_tag_open_att( FILE *fp, int align, char *name )
{
	int	i;

	for( i = 0 ; i < align ; i++ )
		fputc( '\t', fp );


	fprintf( fp, "<%s", name );
}


void	
xmlPut_att_string( FILE *fp, char *name, char *value )
{ 
	fprintf( fp, " %s=\"%s\"", name, value );
}



void	
xmlPut_att_int( FILE *fp, int align, char *name, int value, char *unit )
{ 
	int	i;

	for(  i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	if( unit == NULL )

		fprintf( fp, " %s=\"%d\"", name, value );
	else
		fprintf( fp, " %s=\"%d%s\"", name, value, unit );

}


void	
xmlPut_att_float( FILE *fp, int align, char *name, float value, char *unit )
{ 
	int	i;

	for(  i = 0 ; i < align ; i++ )
		fputc( '\t', fp );

	if( unit == NULL )
		fprintf( fp, " %s=\"%f\"", name, value );
	else
		fprintf( fp, " %s=\"%f%s\"", name, value, unit );

}



void	
xmlPut_tag_close_att( FILE *fp )
{
	fprintf( fp, ">" );
}

